package com.yzc.controller;


import com.yzc.model.vo.system.WebsocketUsersVo;
import com.yzc.result.Result;
import com.yzc.service.WebsocketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/websocket")
public class WebsocketController {

    @Autowired
    private WebsocketService websocketService;

    @GetMapping("/loadUsersList")
    private Result<List<WebsocketUsersVo>> loadUsersList(@RequestParam("id") Integer id) {
        return Result.success(websocketService.loadUsersList(id));
    }

    @GetMapping("/selectUserByUsername")
    private Result<List<WebsocketUsersVo>> selectUserByUsername(@RequestParam("username") String username){
        return Result.success(websocketService.selectUserByUsername(username));
    }

}
